﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BGSpaceShooter
{
    public class StarSphereDrawer : IDrawer
    {
        private StarSphere starSphere;

        public StarSphereDrawer(StarSphere starSphere)
        {
            this.starSphere = starSphere;
        }

        #region IDrawer Members

        public void Draw(Camera camera)
        {
            Display.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
            foreach (ModelMesh mesh in starSphere.Model.Meshes)
            {
                foreach (Effect effect in mesh.Effects)
                {
                    effect.Parameters["xTexture"].SetValue(starSphere.Texture);
                    effect.Parameters["xWorldViewProjection"].SetValue(Matrix.CreateScale(StarSphere.Size) * Matrix.CreateTranslation(camera.CameraPosition) * camera.CameraMatrix * Display.ProjectionMatrix);

                    effect.Parameters["xSetAlpha"].SetValue(false);
                }
                mesh.Draw();
            }
        }

        public IEnumerable<ParticleSystem.EffectDrawer> GetEffectDrawers()
        {
            return new List<ParticleSystem.EffectDrawer>();
        }


        #endregion
    }
}
